var emojiArray = "😀,😃,😄,😁,😆,😅,😂,🤣,😊,😚,😙,😗,😘,😍,😌,😉,🙃,🙂,😇,😋,😜,😝,😛,🤑,🤗,🤓,😎,🤡,🤠,😖,😣,☹,🙁,😕,😟,😔,😞,😒,😏,😫,😩,😤,😠,😡,😶,😐,😑,😯,😦,😥,😢,😨,😱,😳,😵,😲,😮,😧,🤤,😭,😪,😴,🙄,🤔,😬,🤥,🤐,💩,👺,👹,👿,😈,🤕,🤒,😷,🤧,🤢,👻,💀,☠,👽,👾,🤖,🎃,😺,😸,😹,🙏,👏,🙌,👐,😾,😿,🙀,😽,😼,😻".split(',')
onload = function() {
    var click_cnt = 0;
    var $html = document.getElementsByTagName("html")[0];
    var $body = document.getElementsByTagName("body")[0];
    $html.onclick = function(e) {
        var $elem = document.createElement("b");
        $elem.style.color = "#E94F06";
        $elem.style.zIndex = 9999;
        $elem.style.position = "absolute";
        $elem.style.select = "none";
        var x = e.pageX;
        var y = e.pageY;
        $elem.style.left = (x - 10) + "px";
        $elem.style.top = (y - 20) + "px";
        clearInterval(anim);
        switch (++click_cnt) {
            case 10:
                $elem.innerText = "OωO";
                break;
            case 20:
                $elem.innerText = "(๑•́ ∀ •̀๑)";
                break;
            case 30:
                $elem.innerText = "(๑•́ ₃ •̀๑)";
                break;
            case 40:
                $elem.innerText = "(๑•̀_•́๑)";
                break;
            case 50:
                $elem.innerText = "（￣へ￣）";
                break;
            case 60:
                $elem.innerText = "(╯°口°)╯(┴—┴";
                break;
            case 70:
                $elem.innerText = "૮( ᵒ̌皿ᵒ̌ )ა";
                break;
            case 80:
                $elem.innerText = "╮(｡>口<｡)╭";
                break;
            case 90:
                $elem.innerText = "❤Python❤";
                break;
            case 100:
                $elem.innerText = "❤Java❤";
                break;
            case 101:
                $elem.innerText = "❤JavaScript❤";
                break;
            case 102:
                $elem.innerText = "❤PHP❤";
                break;
            case 103:
                $elem.innerText = "❤Golang❤";
                break;
            case 104:
                $elem.innerText = "❤Django❤";
                break;
            case 105:
                $elem.innerText = "(ꐦ°᷄д°᷅)";
                break;
	    case 120:
		click_cnt = 0;
		break;
            default:
		// 手动更换下面这行双引号里面的内容 如"😀"
                $elem.innerText = emojiArray[Math.floor(Math.random() * emojiArray.length)];
                break;
        }
        $elem.style.fontSize = Math.random() * 20 + 10 + "px";
        var increase = 0;
        var anim;
        setTimeout(function() {
        	anim = setInterval(function() {
	            if (++increase == 150) {
	                clearInterval(anim);
			$body.removeChild($elem);
	            }
	            $elem.style.top = y - 20 - increase + "px";
	            $elem.style.opacity = (150 - increase) / 120;
	        }, 8);
        }, 70);
        $body.appendChild($elem);
    };
};


// 鼠标样式
function change_mouse(){
    let a_node = document.createElement('a');
    a_node.href = '/static/image/mouse.png';
    a_node.className = "mouse";
    a_node.style.cssText = "width: 50px;height: 50px;border-radius: 50%;position: fixed;left: -200px;z-index: 99999; pointer-events: none;";
    let par_node = $("#app");
    par_node.append(a_node);
    console.log(a_node);
    console.log(document.getElementById("app"))
}

function mouse_onload() {
    var mouse = document.querySelector('.mouse');
    console.log(mouse, 111)
    window.addEventListener('mousemove',function(event){
        console.log('move', event.clientX, event.clientY) 
        mouse.style.left = event.clientX - mouse.offsetWidth/2 + 'px' ;
        mouse.style.top = event.clientY -mouse.offsetHeight/2 + 'px';       
    })
}


// 点击特效
onload()
